From a9fd28e8cd3a9cf78baa63a542326237429ab1be Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Thu, 21 Jan 2010 00:00:20 +0000 Subject: [PATCH] Fix up data directory sniffing for sqlite. Touch up description of data dir. Also, importPost() default values have to match default values in the HTML form, or they're meaningless. --- config/Installer.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/config/Installer.php b/config/Installer.php index b3eb386d2f..6ab7680130 100644 --- a/config/Installer.php +++ b/config/Installer.php @@ -628,7 +628,7 @@ print "
  • Environment check $conf->SysopName = importPost( "SysopName", "WikiSysop" ); $conf->SysopPass = importPost( "SysopPass" ); $conf->SysopPass2 = importPost( "SysopPass2" ); - $conf->RootUser = importPost( "RootUser", "root" ); + $conf->RootUser = importPost( "RootUser" ); $conf->RootPW = importPost( "RootPW", "" ); $useRoot = importCheck( 'useroot', false ); $conf->LanguageCode = importPost( "LanguageCode", "en" ); @@ -644,7 +644,7 @@ print "
  • Environment check $conf->DBpgschema = importPost( "DBpgschema", "mediawiki" ); ## SQLite specific - $conf->SQLiteDataDir = importPost( "SQLiteDataDir", "" ); + $conf->SQLiteDataDir = importPost( "SQLiteDataDir", '../data' ); ## MSSQL specific // We need a second field so it doesn't overwrite the MySQL one @@ -953,9 +953,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) { if (is_callable(array($wgDatabase, 'initial_setup'))) $wgDatabase->initial_setup('', $wgDBname); } elseif ( $conf->DBtype == 'sqlite' ) { - if ("$wgSQLiteDataDir" == '') { - $wgSQLiteDataDir = dirname($_SERVER['DOCUMENT_ROOT']).'/data'; - } + $wgSQLiteDataDir = $conf->SQLiteDataDir; echo '
  • Attempting to connect to SQLite database at "' . htmlspecialchars( $wgSQLiteDataDir ) . '": '; if ( !is_dir( $wgSQLiteDataDir ) ) { @@ -1004,7 +1002,9 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) { } else { $myver = $wgDatabase->getServerVersion(); } - if (is_callable(array($wgDatabase, 'initial_setup'))) $wgDatabase->initial_setup('', $wgDBname); + if ( is_callable( array( $wgDatabase, 'initial_setup' ) ) ) { + $wgDatabase->initial_setup('', $wgDBname); + } echo "ok
  • \n"; } elseif ( $conf->DBtype == 'oracle' ) { echo "
  • Attempting to connect to database \"" . htmlspecialchars( $wgDBname ) ."\"
  • "; @@ -1664,9 +1664,9 @@ if( count( $errs ) ) { aField( $conf, "SQLiteDataDir", "SQLite data directory:" ); ?>
    -

    SQLite stores table data into files in the filesystem. - If you do not provide an explicit path, a "data" directory in - the parent of your document root will be used.

    +

    SQLite stores table data into files in the + filesystem. By default the path is the "data" + directory in your document root.

    This directory must exist and be writable by the web server.

    @@ -1789,6 +1789,10 @@ function writeLocalSettings( $conf ) { $convert = ($conf->ImageMagick ? $conf->ImageMagick : "/usr/bin/convert" ); $rights = ($conf->RightsUrl) ? "" : "# "; $hashedUploads = $conf->safeMode ? '' : '# '; + $sqliteDataDir = escapePhpString( realpath($conf->SQLiteDataDir) ); + if ( substr_compare( $conf->IP, $sqliteDataDir, 0 ) ) { + $sqliteDataDir = substr_replace( $sqliteDataDir, '$IP', 0, strlen($conf->IP) ); + } if ( $conf->ShellLocale ) { $locale = ''; @@ -1881,7 +1885,7 @@ function writeLocalSettings( $conf ) { } elseif( $conf->DBtype == 'sqlite' ) { $dbsettings = "# SQLite-specific settings -\$wgSQLiteDataDir = \"{$slconf['SQLiteDataDir']}\";"; +\$wgSQLiteDataDir = \"{$sqliteDataDir}\";"; } elseif( $conf->DBtype == 'mssql' ) { $dbsettings = "# MSSQL specific settings -- 2.20.1